import 'package:flutter/services.dart';

class NativeCommunication {
  static const MethodChannel _channel = MethodChannel('com.xinyi.smart_translator/channel');

  static Future<String?> startRecorder() async {
    try {
      final String? result = await _channel.invokeMethod('startRecording');
      return result;
    } on PlatformException catch (e) {
      print("Failed to call native method: '${e.message}'.");
      return null;
    }
  }

  static Future<String?> stopRecorder() async {
    try {
      final String? result = await _channel.invokeMethod('stopRecording');
      return result;
    } on PlatformException catch (e) {
      print("Failed to get device info: '${e.message}'.");
      return null;
    }
  }
}